﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _3_2_1_
{
    internal class Program
    {
        static void Main(string[] args)
        {
            float length, width, price;
            int layers;

            Console.Write("请输入楼房长(米): ");
            length = float.Parse(Console.ReadLine());

            Console.Write("请输入楼房宽(米): ");
            width = float.Parse(Console.ReadLine());

            Console.Write("请输入楼层数(层): ");
            layers = int.Parse(Console.ReadLine());

            Console.Write("请输入楼单价(万): ");
            price = float.Parse(Console.ReadLine());

            Building b = new Building(length, width, layers);
            b.MyPrice = price;

            Console.WriteLine("\n---以下是输出---\n");
            Console.Write("楼房总面积为(平方): ");
            Console.WriteLine(b.GetArea());
            Console.Write("楼房总价格为(万元): ");
            Console.WriteLine(b.TotalPrice());
            Console.Write("\n按任意键结束程序: ");
            Console.ReadKey();
        }
    }

    class Building
    {
        private float length, width, price;
        private int layers;

        public float GetArea()
        {
            return length * width * layers;
        }

        public float TotalPrice()
        {
            return GetArea() * price;
        }

        public float MyPrice
        {
            set { price = value; }
            get { return price; }
        }

        public Building(float l, float w, int lys)
        {
            this.length = l;
            this.width = w;
            this.layers = lys;
        }
    }
    
}
